package com.gxa.hualianeshop.controller;

import com.gxa.hualianeshop.common.base.R;
import com.gxa.hualianeshop.entity.dto.OrderDto;
import com.gxa.hualianeshop.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bill
 * @date 2023/7/21 15:44
 */


@Api("订单的web接口")
@RestController
@RequestMapping("/order")
public class OrderController {


    @Reference
    private OrderService orderService;


    @ApiOperation(value = "生成订单",notes = "")
    @PostMapping("/create")
    public R create(@RequestBody OrderDto orderDto){
       return R.ok(orderService.create(orderDto));
    }

    // 基于ThreadLocal
   /* public R create(){
        // 通过ThreadLocal获取用户编号
        // 隐式传参
        Long id = UserThreadLocal.get().getId();
        return R.ok();
    }*/

}
